import * as THREE from 'three';
import { GLTFLoader } from 'three/addons/loaders/GLTFLoader.js';
const model = new THREE.Group();

const loader = new GLTFLoader();
loader.load("/卡车.glb", function (gltf) { //gltf加载成功后返回一个对象
  gltf.scene.traverse((obj)=>{
    if(obj.type === "Mesh"){
      obj.material = new THREE.MeshLambertMaterial({
        color: 0x1A92C6, //批量设置颜色
        // transparent: true,//允许透明计算
        // opacity: 0.7,//半透明设置
      })
      const edges = new THREE.EdgesGeometry( obj.geometry );
      const line = new THREE.LineSegments( edges, new THREE.LineBasicMaterial( { color: 0x31DEEF } ) );
      model.add(line)
    }
  })
  })
  model.rotateX(Math.PI/2)
export {model};